<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="/tld/dictionary" prefix="dictionary"%>
<%@ taglib uri="/tld/flowdictionary" prefix="flowdictionary"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>添加卖单</title>
<link rel="stylesheet" href="${ctx}/static/css/style.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/kongjian.css" type="text/css" />
<link rel="stylesheet" href="${ctx}/static/css/m.css" type="text/css" />
<link rel="stylesheet" href="${ctx}/static/css/thickbox.css" type="text/css"/>
<script src="${ctx}/static/script/jquery-1.4.min.js" type="text/javascript"></script>
<script src="${ctx}/static/script/jquery.ui.core.js" type="text/javascript"></script>
<script type="text/javascript" src="${ctx}/static/My97DatePicker/WdatePicker.js"></script>
<script src="${ctx}/static/script/jquery.form.js"></script>
<script src="${ctx}/static/script/jsCoreUtil.js"></script>
<script type="text/javascript" src="${ctx}/static/script/thickbox.js"></script>
<script type="text/javascript" src="${ctx}/static/script/jquery.blockUI.js"></script>
<script language="javascript">
//js日期格式化
Date.prototype.pattern=function(fmt) {        
    var o = {        
    "M+" : this.getMonth()+1, //月份        
    "d+" : this.getDate(), //日        
    "h+" : this.getHours()%12 == 0 ? 12 : this.getHours()%12, //小时        
    "H+" : this.getHours(), //小时        
    "m+" : this.getMinutes(), //分        
    "s+" : this.getSeconds(), //秒        
    "q+" : Math.floor((this.getMonth()+3)/3), //季度        
    "S" : this.getMilliseconds() //毫秒        
    };        
    var week = {        
    "0" : "\u65e5",        
    "1" : "\u4e00",        
    "2" : "\u4e8c",        
    "3" : "\u4e09",        
    "4" : "\u56db",        
    "5" : "\u4e94",        
    "6" : "\u516d"     
    };        
    if(/(y+)/.test(fmt)){        
            fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));        
    }        
    if(/(E+)/.test(fmt)){        
            fmt=fmt.replace(RegExp.$1, ((RegExp.$1.length>1) ? (RegExp.$1.length>2 ? "\u661f\u671f" : "\u5468") : "")+week[this.getDay()+""]);        
    }        
    for(var k in o){        
            if(new RegExp("("+ k +")").test(fmt)){        
                    fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));        
            }        
    }        
    return fmt;        
}


function bb(x){
	if(x==2){
		var v = "投资编号："+GetInputValue("investId-h")+"  &nbsp;&nbsp;理财客户编号："+GetInputValue("accId-h")+"  &nbsp;&nbsp;理财客户姓名："+GetInputValue("customerName-h")+"  &nbsp;&nbsp;约定交割日期："+GetInputValue("appointPaymentDate")+" 回款日："+dictionary.get(GetInputValue("loanReturnDate"))+"&nbsp;&nbsp;卖出金额总和: <span id='totalAmt'>"+formatCurrency(interceptionDouble(total_input))+"</span>";
		document.getElementById('form2divinfo').innerHTML = v;
		total_input=0;
		for(var i=0;i<sellorderArray.arr.length;i++){
			var key = sellorderArray.arr[i].key;
			var loanInfo  = sellorderArray.get(key.toString());
			total_input=total_input+Number(interceptionDouble(Number(loanInfo[7])));
		}
		SetDivValue('totalAmt',formatCurrency(total_input) );
	}else if(x==3){
		var v = "投资编号："+GetInputValue("investId-h")+"  &nbsp;&nbsp;理财客户编号："+GetInputValue("accId-h")+"  &nbsp;&nbsp;理财客户姓名："+GetInputValue("customerName-h")+"  &nbsp;&nbsp;约定交割日期："+GetInputValue("appointPaymentDate")+" 回款日："+dictionary.get(GetInputValue("loanReturnDate"))+"&nbsp;&nbsp;卖出金额总和: <span id='totalAmt2'></span>";
		document.getElementById('form3divinfo').innerHTML = v;
	}
	for(i=1;i<4;i++){
		document.getElementById("t"+i).style.display="none";
		document.getElementById("a_m"+i).style.background="#fff";
	}
	document.getElementById("t"+x).style.display="block";
	document.getElementById("a_m"+x).style.background="#c6defa";	
}
</script>
</head>

<body style="margin:10px;">
<p style="padding-bottom:5px;">
<a id="a_m1"  class="a_m">卖单信息</a><!-- onclick="bb(1)" -->
<a id="a_m3"  class="a_m" style="background:#fff; border-left:0;">投资债权明细</a><!-- onclick="bb(3)" -->
<a id="a_m2"  class="a_m" style="background:#fff; border-left:0;">卖单明细</a><!-- onclick="bb(2)" -->
</p>
<div style="clear:both;"></div>
<form:form id="mainform1" name="mainform1" action="#"  modelAttribute="sellOrderMainForm" method="post" >
<input id="loanReturnDate" name="loanReturnDate" value="${fortuneInfoForm.loanReturnDate}" type="hidden"/>
<input id="loanCode" name="loanCode" value="${fortuneInfoForm.productType}" type="hidden"/>
<input id="investId-h" name="investId-h" value="${fortuneInfoForm.id}" type="hidden"/>
<input id="customerName-h" name="customerName-h" value="${fortuneInfoForm.customerInfo.cnName}" type="hidden"/>
<input id="accId-h" name="accId-h" value="${fortuneInfoForm.customerInfo.customerCode}" type="hidden"/>
<div style=" border:#3b97e4 solid 1px; padding:10px 0 20px;" id="t1">
<table class="m_table">
	<tr>
		<td>投资编号：<input type="text" id="investId" name="investId" value="${fortuneInfoForm.id}" readOnly="true" /><a href="#" onClick="tb_show('','#TB_inline?height=375&amp;width=650&amp;inlineId=showbox&amp;modal=true','');" ><input name="Input" type="button" class="chaxun_btn" value="&nbsp;&nbsp;&nbsp;选择" /></a></td>
	</tr>
	<tr>
        <td>理财客户姓名：<input type="text" id="customerName" name="customerName" value="${fortuneInfoForm.customerInfo.cnName}" readOnly="true" /><div id="div_customerName" style="display:none;"><font color='red'>理财客户姓名不能为空!</font></div><br></td>
	</tr>
	<tr>
        <td>理财客户编号：${fortuneInfoForm.customerInfo.customerCode}</td>
	</tr>
	<tr>
        <td>出借协议版本：v1.0</td>
	</tr>
	<tr>
        <td>是否尽快转让：
        <select id="isExpress" >
			<option value="1">是</option>
			<option value="0">否</option>
		</select>
        </td>
	</tr>
	<tr>
        <td>转让服务费折扣率：
        <select id="sellFeeDiscount" name="sellFeeDiscount">
			<option value="0.1">10%</option>
			<option value="0.2">20%</option>
			<option value="0.3">30%</option>
			<option value="0.4">40%</option>
			<option value="0.5">50%</option>
			<option value="0.6">60%</option>
			<option value="0.7">70%</option>
			<option value="0.8">80%</option>
			<option value="0.9">90%</option>
			<option value="1.0" selected>100%</option>
		</select>
		<script>
    	var loanCode=document.mainform1.loanCode.value;
    	var investId=document.getElementById("investId-h").value;
    	if((investId=="1"||investId=="2")||(loanCode=="00140001"||loanCode=="00140002")){
    		document.mainform1.sellFeeDiscount.disabled=true;
    	}
    	if(loanCode=="00140001"||loanCode=="00140002"){
    		document.mainform1.isExpress.disabled=true;
    	}
    </script>
        </td>
	</tr>
	<tr>
        <td>申请卖出日期：<input type="text" id="sellDate" name="sellDate" readonly="true"  value="${fortuneInfoForm.sysCurrentDate}" onClick="WdatePicker()"/>
        </td>
	</tr>
	<tr>
        <td>约定交割日期：<input type="text" id="appointPaymentDate" name="appointPaymentDate"  value="" readonly="true"  onClick="WdatePicker()"/>
        <div id="div_appointPaymentDate" style="display:none;"><font color='red'>约定交割日期不能为空!</font></div><br>
        </td>
	</tr>
	<tr>
        <td>约定交割对价金额：<input type="text" id="appointAmt" name="appointAmt" value="" disabled="disabled"/></td>
	</tr>
	<tr>
        <td valign="middle"><span style="float:left;">备注：</span><textarea id="memo" name="memo"  style="width:500px; height:80px;"></textarea></td>
	</tr>
	<tr>
	    <td colspan="2">
	    <a href="#" id="SellConfirm"  class="btn1" style="margin-right:15px;">确认</a>
	    <a href="#" onclick="window.location=('${ctx}/sellOrder/sell_order_list');"  class="btn1">取消</a>
	    </td>
	</tr>
</table>

</div>
</form:form>
<form:form id="mainform2" action="#"  modelAttribute="recommendInfoForm" method="post" >
<input id="valuesString" name="valuesString" value="" type="hidden"/>
<input id="appointPaymentDate" name="appointPaymentDate" value="" type="hidden"/>
<input id="isExpress" name="isExpress" value="" type="hidden"/>
<input id="memo" name="memo" value="" type="hidden"/>
<input id="sellFeeDiscount" name="sellFeeDiscount" value="" type="hidden"/>
<input id="sellDate" name="sellDate" value="" type="hidden"/>
<div style=" border:#3b97e4 solid 1px; padding:10px 0 20px;" id="t2">
	<div >
		<div style=" text-align:left; height:30px; margin:0 20px; padding:0 10px; line-height:30px; border:#3b97e4 solid 1px;" id="form2divinfo">
		</div>
    </div>
	<!-- 
	<div class="shenqing2">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
	      <tr>
            <td width="80">客户编号：</td>
            <td width="130px" style="color:#2E74D1;"><input type="text" class="ggkj_inputtext_80" value="" /></td>
            <td width="85">客户姓名：</td>
            <td width="150px" style="color:#2E74D1;"><input type="text" class="ggkj_inputtext_80" value="" />
            </td>
			<td width="85">投资编号：</td>
            <td width="150px" style="color:#2E74D1;"><input type="text" class="ggkj_inputtext_80" value="" />
            </td>
			<td width="85">订单编号：</td>
            <td width="150px" style="color:#2E74D1;"><input type="text" class="ggkj_inputtext_80" value="" />
			 <td width="93"><input name="Input" type="button" class="chaxun_btn" value="&nbsp;&nbsp;查询" />
             </td>
          </tr>
      </table>
    </div>
	 -->
	<p style="padding-left:20px;"><a href="#" onclick="sellorder_save();" id='sellOrderSave' class="btn1">保存</a></p>
	<div style="clear:both;"></div>
	<div class="yiban">
	<div id="mainform2table_div"></div>
</div>

<!-- 
<div class="ggkj_pagecontainer">
  <div class="ggkj_pageBGleft">
    	<span class="ggkj_pageBGright"></span>
    	<a href="#" class="ggkj_pageUpa">
        
        </a>
        <a href="#" class="ggkj_pageUp">
        
        </a>
        <span class="ggkj_insertline"></span>
        <span class="ggkj_pageSpan">
        	页<input type="text" class="ggkj_inputtext_30">OF <span id="totalPages2">0</span>
        </span>
        <span class="ggkj_insertline"></span>
        <a href="#" class="ggkj_pageDown">
        
        </a>
        <a href="#" class="ggkj_pageDowna">
        
        </a>
        <span class="ggkj_insertline"></span>
    </div>
</div>
 -->
</div>
</form:form>
<form:form id="mainform3" action="#"  modelAttribute="loanInfoForm" method="post" >
<input type="hidden" id="accountNo" name="accountNo" value="${fortuneInfoForm.accId}"/>
<input type="hidden" id="appdate" name="appdate" value=""/>
<div style=" border:#3b97e4 solid 1px; padding:10px 0 20px;" id="t3">
	<div>
		<div style=" text-align:left; height:30px; margin:0 20px; padding:0 10px; line-height:30px; border:#3b97e4 solid 1px;" id="form3divinfo"></div>
    </div>
	<div class="shenqing2">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
	      <tr>
            <td width="80">债权编号：</td>
            <td width="130px" style="color:#2E74D1;"><input type="text" name="loanId" id="loanId" class="ggkj_inputtext_80" value="" /></td>
            <td width="85">债务人：</td>
            <td width="150px" style="color:#2E74D1;"><input type="text" name="customerName" id="customerName"  class="ggkj_inputtext_80" value="" />
            </td>
			 <td width="93"><input name="Input" type="button" class="chaxun_btn" value="&nbsp;&nbsp;查询" onclick="ajaxQueryLoanInfos()"/>
             </td>
          </tr>
      </table>
    </div>
    <p style="padding-left:20px;">
    <input type="button"  id="allsell"  class="btn1" style="margin-right:15px;" value="全部卖出"><!-- onclick="select_all_loan();" -->
    <input type="button" id="sellout" onclick="submitform3();"  value = "卖出" class="btn1">
    </p>
	<div style="clear:both;"></div>
	<div class="yiban">
	<div id="mainform3table_div" ></div>
</div>
<div class="ggkj_pagecontainer" id="pageNavigator">
  <div class="ggkj_pageBGleft">
    	<span class="ggkj_pageBGright"></span>
    	<a href="javascript:jumpPage3(1)" class="ggkj_pageUpa">
        
        </a>
        <a href="javascript:jumpPage3(mainform3_page.prePage)" class="ggkj_pageUp">
        
        </a>
        <span class="ggkj_insertline"></span>
        <span class="ggkj_pageSpan">
        	页
        	<input type="text" id="pageNo" name="pageNo" value="1" class="ggkj_inputtext_30"/>OF <span id="totalPages3">0</span>
        </span>
        <span class="ggkj_insertline"></span>
        <a href="javascript:jumpPage3(mainform3_page.nextPage)" class="ggkj_pageDown">
        
        </a>
        <a href="javascript:jumpPage3(mainform3_page.totalPages)" class="ggkj_pageDowna">
        
        </a>
        <span class="ggkj_insertline"></span>
    </div>
</div>
</div>
</div>
</form:form >
<form:form id="mainform4" action="${ctx}/fortune/ajax_get_page_investInfos"  modelAttribute="recommendInfoForm" method="post">
<div style="display:none">
	<input type="hidden" name="id" id="id" value="0"/>
	<input type="hidden" name="pageNo" id="pageNo" value="1"/>
	<div id="output4"></div>
	<div id="showbox" class="yiban">
	<table style="font-size:12px;">
	<tr>
	<td>投资编号:<input type="text" name="investInfo_id" id="investInfo_id"/></td>
	<td>客户姓名:<input type="text" name="investInfo_customerInfo_cnName" id="investInfo_customerInfo_cnName" /></td>
	<td><input type="button" name="查询" value="查询" id="tzbutton"/></td>
	</tr>
	</table>
	<div id="mainform4table_div" algin="left"></div>
		<div class="ggkj_pagecontainer" style="width:100%;">
		  	<div class="ggkj_pageBGleft">
		    	<span class="ggkj_pageBGright"></span>
		    	<a href="javascript:jumpPage4(1)" class="ggkj_pageUpa">
		        </a>
		        <a href="javascript:jumpPage4(mainform4_page.prePage)" class="ggkj_pageUp">
		        </a>
		        <span class="ggkj_insertline"></span>
		        <span class="ggkj_pageSpan">
		        	页
		        	<input type="text" id="pageNo2" name="pageNo2" value="1" class="ggkj_inputtext_30"/>OF <span id="totalPages4">0</span>
		        </span>
		        <span class="ggkj_insertline"></span>
		        <a href="javascript:jumpPage4(mainform4_page.nextPage)" class="ggkj_pageDown">
		        
		        </a>
		        <a href="javascript:jumpPage4(mainform4_page.totalPages)" class="ggkj_pageDowna">
		        
		        </a>
		        <span class="ggkj_insertline"></span>
		    </div>
		</div>
		<div style="width:100%; margin-top:5px; text-algin:center;">
		    <input type="button" value="确定" onClick="mainform4confim();" style="margin-left:260px;"/>&nbsp;&nbsp;&nbsp;
		    <input type="button" value="取消" onClick="tb_remove();"/>
		</div>
	</div>
</div>
</form:form>
<script>
var mainform4_page;
var mainform3_page;
var mainform2_page;
var total_input=0;
//pages init js parameters 
var loanArray = new CoreMap();//loan 
var sellorderArray = new CoreMap(); //sell order
var sellorderErrorArray = new CoreMap(); //sell order
var dictionary = new CoreMap(); //dictionary
var AllLoanArray = new CoreMap(); //所有债权容器
var PageLoanArray = new CoreMap(); //单页债权容器(是所有债权容器子集)


function jumpPage4(pageNo) {
	var thisform = document.getElementById('mainform4');
	thisform.pageNo.value = pageNo.toString();
	document.getElementById("pageNo2").value=pageNo.toString();
	ajax_get_page_investInfos();
}

function jumpPage3(pageNo) {
	var thisform = document.getElementById('mainform3');
	thisform.pageNo.value = pageNo.toString();
	ajaxQueryLoanInfos();
}


/** 查询可卖投资 Start*/
function ajax_get_page_investInfos(){
	var thisformm = document.getElementById('mainform4');
	var investId = GetInputValue('investInfo_id');
	var customerName = GetInputValue('investInfo_customerInfo_cnName');
    var options = {   
        target:     '#output4',   // target element(s) to be updated with server response   
        success:    mainform4Response2, // post-submit callback   
        url:        '${ctx}/fortune/ajax_get_page_investInfos?cnName='+encodeURI(customerName)+'&id='+encodeURI(investId),      // override for form's 'action' attribute   
        type:       'post',       // 'get' or 'post', override for form's 'method' attribute   
        dataType:   'json'       // 'xml', 'script', or 'json' (expected server response type)   
    }; 
    function submitt() {   
        $('#mainform4').ajaxSubmit(options);   
        return false;   
    };  
    submitt();
}
document.body.onkeypress=function() 
{ 
    if   (event.keyCode   ==13){ 
		ajax_get_page_investInfos();
    }	
}
function mainform4Response2(responseText, statusText, xhr, $form){
	var tablename = 'mainform4table';
	mainform4_page = responseText;
	var table ='';
	table = table + "<table style='width:100%;' id='mainform3table' name='mainform3table' class='ggkj_table'  border='0' cellspacing='0' cellpadding='0'> ";
	table = mainform4Title2(table);
	var td ='';
	var inde = 0;
	for(var index=0;index<responseText.result.length;index++){
		inde++;
		td = td + mainform4InsertRow2(tablename,inde,mainform4_page.result[index]);
	}
	
	for(var m=inde;m<10;m++){
		td = td + mainform4InsertRow2Blank(m+1);
	}
	table =table +  td +  "</table>";
	SetDivValue('totalPages4',mainform4_page.totalPages);
	document.getElementById('mainform4table_div').innerHTML = table;
}

function mainform4Title2(tableStr){
	 //alert("create table title .");
	 tableStr  = tableStr +"<tr>";
	 tableStr  = tableStr +"<th scope='col'>序号</th>";
	 tableStr  = tableStr +"<th scope='col'>投资编号</th>";
	 tableStr  = tableStr +"<th scope='col'>客户姓名</th>";
	 tableStr  = tableStr +"<th scope='col'>债权还款日</th>";
	 tableStr  = tableStr +"<th scope='col'>实际投资金额</th>";
	 tableStr  = tableStr +"<th scope='col'>投资产品</th>";
	 tableStr  = tableStr +"<th scope='col'>状态</th>";
	 tableStr  = tableStr +"</tr>";
	 return tableStr;
}

function mainform4InsertRow2(tablename,tbIndex,data){
	 var cssName = '';
	 var td = '';
	 if(Number(tbIndex)%2==1){
	 	cssName = 'ggkj_tdColr';
	 }else{
	 	cssName = '';
	 }
	 td = td + "<tr class='"+cssName+"' >";
  	 td = td +"<td>"+tbIndex+"<input id='investIdIndex' name='investIdIndex' type='checkbox' value='"+data.id+"'/></td>";
	 td = td +"<td height='34'>"+data.id+"</td>";
	 td = td +"<td height='34'>"+data.customerInfo.cnName+"</td>";
	 td = td +"<td height='34'>"+dictionary.get(data.loanReturnDate.toString())+"</td>";
	 if(data.regularType =='00130001'){
		 td = td +"<td height='34'>"+formatCurrency(data.investAmt)+"</td>";	 
	 }else if(data.regularType =='00130002'){
		 td = td +"<td height='34'>"+formatCurrency(data.regularAmt)+"</td>";
	 }
	 td = td +"<td height='34'>"+dictionary.get(data.productType)+"</td>";
	 td = td +"<td height='34'>"+dictionary.get(data.flowId.toString())+"</td>";
	 td = td + "</tr>";
	 return td ;
}
function mainform4InsertRow2Blank(tbIndex){
	 var cssName = '';
	 var td = '';
	 if(Number(tbIndex)%2==1){
	 	cssName = 'ggkj_tdColr';
	 }else{
	 	cssName = '';
	 }
	 td = td + "<tr class='"+cssName+"' >";
  	 td = td +"<td></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"</tr>";
	 return td ;
}

function mainform4confim(){
	var thisformm = document.getElementById('mainform4');
	thisformm.action = '${ctx}/sellOrder/sell_order_init';
    var ids = document.getElementsByName('investIdIndex');
    var isChecked = false;	
    var investId=0;
    var index=0 ;
    for (var i = 0; i < ids.length; i++) {
        if(ids[i].checked==true){
        	investId = ids[i].value;
        	index++;
        }
    }
    if(ids.length>0 && index!=1){
    	alert('请选择一笔投资!');
    	return ;
    }else{
    	thisformm.id.value= investId;
   	 	thisformm.submit();
    }
}
/** 查询可卖投资 end */


/** 查询投资债权明细 start */
function mainform3Title(){
	 var th = "<tr>";
	 th = th + "<th scope='col'>序号<input  type='checkbox' id='num' name='num' onclick='javascript:allchecked("+'"mainform3"'+','+'"_sellorderId1"'+");' /></th>";
	 th = th + "<th scope='col'>债权编号</th>";
	 th = th + "<th scope='col'>债务人</th>";
	 th = th + "<th scope='col'>持有比例</th>";
	 th = th + "<th scope='col'>持有价值</th>";
	 th = th + "<th scope='col'>可卖比例</th>";
	 th = th + "<th scope='col'>申卖比例</th>";
	 th = th + "<th scope='col'>可卖债权价值</th>";
	 th = th + "<th scope='col'>约定交割日价值</th>";
	 th = th + "<th scope='col'>卖出金额</th>";
	 th = th + "<th scope='col'>卖出比例</th>";
	 th = th + "<th scope='col'></tr></th>";
	 return th;
}
var loanMountAmt=0;//债权价值
function mainform3InsertRows(tbIndex,data){
	 if(!CheckDataValue(data)){return;};
	 var loanAcct = data.loanAcct;
	 var loanAmount = data.loanAmount_1;
	 
	 var cssName = '';
	 var td = '';
	 if(Number(tbIndex)%2==1){
	 	cssName = 'ggkj_tdColr';
	 }else{
	 	cssName = '';
	 }
	 td = td + "<tr class='"+cssName+"' >";
	 var isChecked= '';
	 if(sellorderArray.get(data.id.toString())!=null || sellorderArray.get(data.id.toString())==''){
	 	isChecked = 'checked';
	 }
	 
	 var amt_ = (data.loanAmount_1 * (data.debtProportion-data.appScal)).toString().split(".");
  	 var amt_1 = 0;
  	 if(amt_.length>=2 && amt_[1].length>=2 ){
  	 	 amt_1 = amt_[0]+'.'+amt_[1].substring(0,2);
  	 }else{
  	 	amt_1 = amt_;
  	 }
	
	 tbIndex = Number((mainform3_page.pageNo-1)*10)+Number(tbIndex);
	 td = td + "<td>"+(tbIndex)+"<input name='_sellorderId1' id='checkbox"+data.id+"' type='checkbox' "+isChecked+" value='"+data.id+"' onclick='javascript:sellorderDelOnclick("+data.id+");'/>"
	 				+"<input type='hidden' id='financeId"+data.id+"' value="+(data.id)+" />"
	 				+"<input type='hidden' id='loan_holdId"+data.id+"' value="+(data.id)+" />"
	 				+"<input type='hidden' id='loan_irr"+data.id+"' value="+(loanAcct.rateSpare)+" /></td>" ;
	 td = td + "<td><div id='loanId"+data.id+"'>"+(loanAcct.id)+"</div>"
	 				+"<div id='productCode"+data.id+"'  style='display:none;'>"+(loanAcct.productCode)+"</div>"
	 				+"<input  type='hidden' id='_investId"+data.id+"' value="+(GetInputValue('investId-h'))+" /></td>";
	 td = td + "<td><div id='loanCustomer"+data.id+"' >"+(loanAcct.customerName)+"</div></td>";
	 td = td + "<td><div id='holdScal"+data.id+"'  style='display:none;'>"+data.debtProportion +"</div>"+FormatNumber((data.debtProportion),4)+"</td>";
	 td = td + "<td><div id='holdWorth"+data.id+"' >"+formatCurrency((data.debtAmount)) +" </div></td>";
	 td = td + "<td><div id='ksellScal"+data.id+"' style='display:none;'>"+(data.debtProportion-data.appScal)+"</div>"+FormatNumber((data.debtProportion-data.appScal),4)+"</td>";
	 td = td + "<td><div id='ssellScal"+data.id+"' style='display:none;'>"+(data.appScal)+" </div>"+FormatNumber((data.appScal),4)+"</td>";
	 td = td + "<td><div id='divkSellAmt"+data.id+"'>"+(formatCurrency(amt_1) )+"</div></td>";
	 td = td + "<td><div id='jgdateAmt"+data.id+"' >"+formatCurrency(loanAmount) +"</div>"
	 				+"<div id='jgdateAmt_all_number"+data.id+"' style='display:none;'>"+loanAmount+"</div>"
	 				+"<div id='_loanReturnDate" +data.id+"' style='display:none;'>"+(dictionary.get(GetInputValue('loanReturnDate')) )+"</div></td>";
	 td = td + "<td><input id='sellAmt"+data.id+"'  name='sellamt' value='"+getSellAmt(data.id)+"' onkeyup='CalculateLoan2("+loanAmount+","+data.id+","+(data.debtProportion-data.appScal)+");'/>"
	 				+"<div style='display:none;' id='divchecknumlen"+data.id+"'><font color='red'>只允许输入两位小数!</font></div></td>";
	 
	 td = td + "<td><div id='sellScal"+data.id+"'  style='display:none;'>0</div>"
		 			+"<div id='sellScal2"+data.id+"' >"+getSellSacl(data.id)+"</div>"
		 			+"<div style='display:none;' id='divLoanAmt"+data.id+"'><font color='red'>卖出比例不能大于可卖比例!</font></div>"
		 			+"<div style='display:none;' id='divDecideAmt"+data.id+"'><font color='red'>金额有误!</font></div>"
		 			+"<div style='display:none;' id='divDateSpare"+data.id+"'>"+(new Date(loanAcct.dateSpare)).pattern("yyyy-MM-dd")+"</div>"
		 			+"<div style='display:none;' id='divRate"+data.id+"'>"+loanAcct.rate+"</div>"
		 			+"<div id='_status" +data.id+"' style='display:none;' >"+(1) +"</div></td>";
	 td = td + "</tr>";
	return td;
}

function mainform3Response(responseText, statusText, xhr, $form){
	var tablename ='mainform3table';
	mainform3_page = responseText;
	var table ='<table style="width:100%;" id="mainform3table" name="mainform3table" class="ggkj_table"  border="0" cellspacing="0" cellpadding="0">';
	table = table + mainform3Title();
	var investId=document.getElementById("investId-h").value;
	var loanCode=document.mainform1.loanCode.value;
	if(mainform3_page==null || mainform3_page.result.length==0){
		SettingButtonStyle('allsell',true);
		SettingButtonStyle('sellout',true);
	}else if(investId!="1"&&investId!="2"&&(loanCode=="00140001"||loanCode=="00140002")){
		SettingButtonStyle('allsell',false);
		SettingButtonStyle('sellout',true);
	}else{
		//TODO 按钮置灰
		SettingButtonStyle('allsell',false);
		SettingButtonStyle('sellout',false);
	}
	var index = 0;
	for(var i=0;i<mainform3_page.result.length;i++){
		index ++;
		table = table + mainform3InsertRows(index,mainform3_page.result[i]);
	}
	table = table + '</table>';
	SetDivValue('totalPages3',mainform3_page.totalPages);
	document.getElementById('mainform3table_div').innerHTML = table;
	document.getElementById('pageNavigator').style.display='none';
	CheckBoxAlreadyChecked('_sellorderId1','num');
	
}
document.body.onkeypress=function() 
{ 
    if   (event.keyCode   ==13){ 
		ajaxQueryLoanInfos();
    }	
}
function ajaxQueryLoanInfos(){
	SetValue('appdate',GetInputValue('appointPaymentDate'));
	var thisformm = document.getElementById('mainform3');
    var options = {   
        target:        '#output2',   
        success:       mainform3Response, // post-submit callback   
        url:        '${ctx}/loansc/ajax_query_loanInfos',      // override for form's 'action' attribute   
        type:       'post',       // 'get' or 'post', override for form's 'method' attribute   
        dataType:   'json'       // 'xml', 'script', or 'json' (expected server response type)
    };   
    function submitt() {   
        $('#mainform3').ajaxSubmit(options);   
        return false;   
    };  
    submitt();
}
/** 查询投资债权明细  end */


/** 卖单明细 start */
function mainform2Title(){
	var th = "<tr>";
	th = th + "<th scope='col'>序号</th>";//<input  type='checkbox' id='num' name='num' onclick='javascript:sellorderAllchecked("+'"mainform2"'+','+'"_sellorderid"'+");' />
	th = th + "<th scope='col'>债权编号</th>";
	th = th + "<th scope='col'>债务人</th>";
	th = th + "<th scope='col'>月回款日</th>";
	th = th + "<th scope='col'>IRR</th>";
	th = th + "<th scope='col'>可卖比例</th>";
	th = th + "<th scope='col'>已卖比例</th>";
	th = th + "<th scope='col'>可卖债权价值</th>";
	th = th + "<th scope='col'>约定交割日价值</th>";
	th = th + "<th scope='col'>卖出金额</th>";
	th = th + "<th scope='col'>卖出比例</th>";
	th = th + "<th scope='col'>操作</th>";
	//th = th + "<th scope='col'>操作</th>";
	th = th + "</tr>";
	 return th;
	
	return th;
}

function deleteSellOrder(v){
	sellorderArray.remove(v.toString());
	mainform2Response();
	total_input=0;
	for(var i=0;i<sellorderArray.arr.length;i++){
		var key = sellorderArray.arr[i].key;
		var loanInfo  = sellorderArray.get(key.toString());
		total_input=total_input + Number(interceptionDouble(loanInfo[7]));
	}
	SetDivValue('totalAmt',formatCurrency(total_input));
}

function mainform2InsertRows(tbIndex,dataArray){
	 var cssName = '';
	 var td = '';
	 if(Number(tbIndex)%2==1){
	 	cssName = 'ggkj_tdColr';
	 }else{
	 	cssName = '';
	 }
	 var sellmat2 = interceptionDouble(Number(dataArray[19])*Number(dataArray[4]));
	td = td + "<tr class='"+cssName+"' >";
	//td = td + "<td>"+tbIndex+"<input name='_sellorderid' type='checkbox'  value='"+dataArray[0]+"' onclick='javascript:checkSellOrderInfo(this);' />" + "<input  type='hidden' id='sellorder_investId"+dataArray[0]+"' value="+(GetInputValue('investId'))+" >"+ "<input  type='hidden' id='sellorder_holdId"+dataArray[0]+"' value="+(dataArray[9])+" ></td>";
	td = td + "<td>"+tbIndex+ "<input  type='hidden' id='sellorder_investId"+dataArray[0]+"' value="+(GetInputValue('investId'))+" >"+ "<input  type='hidden' id='sellorder_holdId"+dataArray[0]+"' value="+(dataArray[9])+" ></td>";
	td = td + "<td><div id='sellorder_loanId"+dataArray[0]+"' >"+(dataArray[0])+"</div></td>";
	td = td + "<td><div id='sellorder_loanCustomer"+dataArray[0]+"' >"+(dataArray[1])+"</div></td>";
	td = td + "<td><div id='sellorder_loanReturnDate" +dataArray[0]+"' >"+(dictionary.get(GetInputValue('loanReturnDate')) )+"</div></td>";
	td = td + "<td><div id='sellorder_irr"+dataArray[0]+"' >"+(dataArray[10]) +"</div></td>";
	td = td + "<td><div id='sellorder_sacl"+dataArray[0]+"' >"+(FormatNumber(dataArray[4],4)) +"</div></td>";
	td = td + "<td><div id='sellorder_ymsacl"+dataArray[0]+"' >"+(FormatNumber(dataArray[5],4) ) +"</div></td>";	
	td = td + "<td>"+formatCurrency(sellmat2)+"</td>";
	td = td + "<td><div id='sellorder_jgdateAmt"+dataArray[0]+"' >"+(formatCurrency(dataArray[6]) ) +"</div></td>";
	td = td + "<td><input id='sellorder_sellAmt"+dataArray[0]+"'  name='sellamt' value='"+(dataArray[18])+"' readOnly='true' /></td>";
	td = td + "<td><div id='sellorder_sellscal"+dataArray[0]+"' style='display:none;'>"+(FormatNumber(dataArray[8],4))+"</div> <div id='sellorder_sellscal2"+dataArray[0]+"' >"+FormatNumber(dataArray[12],4)+"</div></td>";
	//td = td + "<td><div id='sellorder_status" +dataArray[0]+"' >"+(1) +"</div><div id='sellorder_productCode" +dataArray[0]+"' style='display:none;'>"+(dataArray[11]) +"</div></td>";
	td = td + "<td><input name='deleteSellOrderButton' type='button' value='删除 ' onclick='deleteSellOrder("+dataArray[9]+")'	/></td>";
	
	//td = td + "<td><a href='#' onclick='javascript:deleteSellOrder("+dataArray[0]+");'></a></td>";
	td = td + "</tr>";
	return td;
}

function mainform2Response(){
	var table = '<table style="width:100%;" class="ggkj_table"  border="0" cellspacing="0" cellpadding="0">';
	table = table + mainform2Title();
	//showsellorderArray('卖单明细：'+sellorderArray);
	for(var i=0;i<sellorderArray.arr.length;i++){
		var key = sellorderArray.arr[i].key;
		var loanInfo  = sellorderArray.get(key.toString());
		table = table + mainform2InsertRows(i+1,loanInfo);
	}
	document.getElementById('mainform2table_div').innerHTML = table;
	var investId=document.getElementById("investId-h").value;
	var loanCode=document.mainform1.loanCode.value;
	var deleteSellOrderButtons=document.getElementsByName("deleteSellOrderButton");
	if(investId!="1"&&investId!="2"&&(loanCode=="00140001"||loanCode=="00140002")){
		for(i=0;i<deleteSellOrderButtons.length;i++){
			deleteSellOrderButtons[i].disabled=true;
		}
    	
    }
	
}
/** 卖单明细  end */

 // unblock when ajax activity stops 
$(document).ajaxStop($.unblockUI); 
function sellorder_save(){
	if(sellorderArray.arr.length==0){
		alert('请勾选卖单!');
		return ;
	}
	$.blockUI({ message: '<div><img src="${ctx}/static/images/busy.gif" /><font size="4px"> Just a moment...</font></div>' }); 
	document.getElementById('mainform2').memo.value = document.getElementById('mainform1').memo.value;
	var valuesString ='';
	for(var i=0;i<sellorderArray.arr.length;i++){
		if(sellorderArray.arr[i].value!=null){
			for(var m=0;m<sellorderArray.arr[i].value.length;m++){
				valuesString = valuesString + sellorderArray.arr[i].value[m] +':';
			}
			valuesString = valuesString + '#';
		}
	}
	SetValue('valuesString',valuesString);
	SubmitForm('mainform2','${ctx}/sellOrder/sell_order_save');
}


//all checked put value
function allchecked(formname,checkboxname){
	sellorderArray = AllCheckedByCheckBoxNamePutValue(formname,checkboxname,sellorderArray,getLoanDelNameArray());
}

//sellorder all checked
function sellorderAllchecked(formname,checkboxname){
	sellorderArray = AllCheckedByCheckBoxNamePutValue(formname,checkboxname,sellorderArray,getSellNameArray());
}

//sellorder del add date
function sellorderDelOnclick2(id){
	var nameArray = getLoanDelNameArray();
    var key = id.toString();
	if(GetDOMById('checkbox'+id).checked==true){
    	var lineValue = new Array(); 
	    for(var k=0;k<nameArray.length;k++){
	    	var inputtype = nameArray[k].split(':');
	    	var ids =  inputtype[0] + key;
	    	if('div'==inputtype[1]){
	    		lineValue[k] = GetDivValue(ids.toString());
	    	}else if('input'==inputtype[1]){
	    		lineValue[k] = GetInputValue(ids.toString());
	    	}
	    }
	    loanArray.put(key,lineValue);
	}else{
		loanArray.remove(key);
	}
}

function mainform1_init(){
	SetValueByFrom(GetDOMById('mainform2').appointPaymentDate,GetDOMById('mainform1').appointPaymentDate.value);
	SetValueByFrom(GetDOMById('mainform2').isExpress,GetDOMById('mainform1').isExpress.value);
	SetValueByFrom(GetDOMById('mainform2').sellFeeDiscount,GetDOMById('mainform1').sellFeeDiscount.value);
	SetValueByFrom(GetDOMById('mainform2').sellDate,GetDOMById('mainform1').sellDate.value);
	if(GetInputValue('customerName')=='' ){
		GetDOMById('div_customerName').style.display='';
		return false;
	}else{
		GetDOMById('div_customerName').style.display='none';
	}
	if(GetInputValue('appointPaymentDate')=='' ){
		GetDOMById('div_appointPaymentDate').style.display='';
		return false;
	}else{
		GetDOMById('div_appointPaymentDate').style.display='none';
	}
	if(document.getElementById('mainform1').memo.value.length>50){
		alert("备注不能超过50个字符！");
		return false;
	}
	var appointPaymentDate=document.mainform1.appointPaymentDate.value;
	var sellDate=document.mainform1.sellDate.value;
	var c="<c:out value='${fortuneInfoForm.sysCurrentDate}'/>";
	if(sellDate>c){
		alert("申请卖出日期不能大于今天！");
		return false;
	}
	if(appointPaymentDate<c){
		alert("约定交割日期不能小于今天！");
		return false;
	}
	/*
	re = /^\d+(?=\.{0,1}\d+$|$)/
	if (!re.test($("#appointAmt").val()) || Number($("#appointAmt").val())<0 || Number($("#appointAmt").val())==0) {
		    alert("约定交割对价金额有误!");
		    return false;
	}*/
	return true;
}

function summitform1(){
	if(mainform1_init() ){
	 	ajaxQueryLoanInfos();
	 	bb(3);
 	}else{
 		return;
 	}
}
function submitform3(){
	for(var m1=0;m1<sellorderErrorArray.arr.length;m1++){
		var keyv = sellorderErrorArray.arr[m1].key;
		if(sellorderArray.get(keyv.toString())!=null){
			alert('投资债权勾选数据中含有异常数据(卖出比例不能大于可卖比例!)');
			return false;
		}
	}
	
	if(sellorderArray.arr.length==0){
		alert('未勾选待卖出债权!');
		return ;
	}
	
	var value =0;
	for(var i=0;i<sellorderArray.arr.length;i++){
		if(Number(sellorderArray.arr[i].value[7])==0){
			alert('卖出债权含有零值交易.');
			return ;
		}
		value = value + Number(sellorderArray.arr[i].value[7]);
	}
	
	mainform2Response();
	bb(2);
}

$(document).ready(function() { 
	dictionary = dictionaryInit();
	ajax_get_page_investInfos();
	//SetValue('sellDate',(new Date()).pattern("yyyy-MM-dd"));
}); 

function CheckDataValue(data){
	 if(data==null ||data.loanAcct==null ){
	 	alert('数据库数据存在异常，非空值含有空情况!');
	 	return false;
	 }
	 return true;
}

function CalculateLoan2(loanAmt,id,ksellscal){
		var loanValue = Number( GetInputValue('sellAmt'+id) );
		re = /^\d+(?=\.{0,1}\d+$|$)/
		
		
		//卖出比例
		var recommendscal2 = loanValue/Number(loanAmt);
		//可买比例
		var ksellScal =Number(GetDivValue('ksellScal'+id));
		var recommendScal =	FormatNumber(recommendscal2,4);
		GetDOMById('sellScal'+id).innerHTML =recommendscal2;
		GetDOMById('sellScal2'+id).innerHTML =recommendScal;
		
		//0.34519299878928178345988475786333
		//0.34519299878928177
		//0.00000000000000002
		//var t = new Number(recommendscal2-ksellScal)*Math.pow(10,10) ;
		//alert(recommendscal2+'           '+ksellScal+'            '+ t   );
		if(recommendscal2-ksellScal >0.000000009 ){//显示提示,小数点后9位
			sellorderErrorArray.put(id.toString());
			SettingButtonStyle('allsell',true);
			SettingButtonStyle('sellout',true);
			GetDOMById('divLoanAmt'+id).style.display = '';
			GetDOMById('sellAmt'+id).focus();
		}else{//不显示提示
			sellorderErrorArray.remove(id.toString());
			GetDOMById('divLoanAmt'+id).style.display = 'none';
			SettingButtonStyle('allsell',false);
			SettingButtonStyle('sellout',false);
		}
		
		if(!re.test(loanValue) ){
			GetDOMById('divDecideAmt'+id).style.display = '';
		}else{
			GetDOMById('divDecideAmt'+id).style.display = 'none';
		}
		var lv = loanValue.toString().split('.');
		if(lv.length==2){
			if(lv[1].length>2){
				GetDOMById('divchecknumlen'+id).style.display = '';
				SettingButtonStyle('allsell',true);
				SettingButtonStyle('sellout',true);
			}else{
				GetDOMById('divchecknumlen'+id).style.display = 'none';
				SettingButtonStyle('allsell',false);
				SettingButtonStyle('sellout',false);
			}
		}
		
		sellorderDelOnclick(id);
		total_input=0;
		for(var i=0;i<mainform3_page.result.length;i++){
			total_input=total_input+Number(interceptionDouble( GetInputValue('sellAmt'+mainform3_page.result[i].id) ));
		}
		SetDivValue('totalAmt2',formatCurrency(total_input));
}

function getSellNameArray(){
	var nameArray = new Array();
	nameArray[0]='sellorder_loanId:div';
	nameArray[1]='sellorder_loanCustomer:div';
	nameArray[2]='sellorder_loanReturnDate:div';
	nameArray[3]='sellorder_irr:div';
	nameArray[4]='sellorder_jgdateAmt:div';
	nameArray[5]='sellorder_sellAmt:input';
	nameArray[6]='sellorder_sellscal:div';
	nameArray[7]='sellorder_status:div';
	nameArray[8]='sellorder_investId:input';
	nameArray[9]='sellorder_holdId:input';
	nameArray[10]='sellorder_productCode:div';
	return nameArray;
}

function getLoanDelNameArray(){
	var nameArray = new Array();
	nameArray[0]='loanId:div';
	nameArray[1]='loanCustomer:div';
	nameArray[2]='holdScal:div';
	nameArray[3]='holdWorth:div';
	nameArray[4]='ksellScal:div';
	nameArray[5]='ssellScal:div';
	nameArray[6]='jgdateAmt:div';
	nameArray[7]='sellAmt:input';
	nameArray[8]='sellScal:div';
	nameArray[9]='loan_holdId:input';
	nameArray[10]='loan_irr:input';
	nameArray[11]='productCode:div';
	nameArray[12]='sellScal2:div';
	nameArray[13]='_loanReturnDate:div';
	nameArray[14]='_investId:input';
	nameArray[15]='_status:div';
	nameArray[16]='divDateSpare:div';
	nameArray[17]='divRate:div';
	nameArray[18]='sellAmt:input';
	nameArray[19]='jgdateAmt_all_number:div';//约定交割日价值保留小数全价值
	
	return nameArray;
}

function sellorderDelOnclick(sellorderId){
	var ids =document.getElementsByName('_sellorderId1');
	var nameArray = getLoanDelNameArray();
	var totalAmt = 0;
	for(var m=0;m<ids.length;m++){
		var key = ids[m].value.toString();
		
		if(ids[m].checked==true){
			var lineValue = new Array(); 
			for(var k=0;k<nameArray.length;k++){
				var inputtype = nameArray[k].split(':');
				var id =  inputtype[0] + key;
				if('div'==inputtype[1] || 'span'==inputtype[1] ){
					lineValue[k] = GetDivValue(id.toString());
				}else if('input'==inputtype[1]){
					lineValue[k] = GetInputValue(id.toString());
				}
			}
			sellorderArray.put(key,lineValue);
		}else{
			sellorderArray.remove(key);
		}
	}
	
	//TODO
	CheckBoxAlreadyChecked('_sellorderId1','num');
	//SetDivValue('totalAmt',totalAmt);
	//SetDivValue('totalAmt',totalAmt);
}

function showsellorderArray(){
	for(var i=0;i<sellorderArray.arr.length;i++){
		var v='';
		for(var i1=0;i1<sellorderArray.arr[i].value.length;i1++){
			v  = v + sellorderArray.arr[i].value[i1] + ',';
		}
	}
	alert(v);
	return v;
}


function getSellSacl(sellorderId){
	var sellorderarray = sellorderArray.get(sellorderId.toString());
	if(sellorderarray==null){
		return 0;
	}
	return sellorderarray[12];
}

function getSellAmt(sellorderId){
	var sellorderarray = sellorderArray.get(sellorderId.toString());
	if(sellorderarray==null){
		return 0;
	}
  	 
	return interceptionDouble(sellorderarray[7]);
}

//全部卖出功能-----------------------------------start------------------------------------------
//延迟等待
 // unblock when ajax activity stops 
$(document).ajaxStop($.unblockUI); 

$(document).ready(function() { 
    $('#allsell').click(function() { 
		var isTrue = confirm("您确定全部卖出吗？本操作可能需要时间较长!");
	    if(isTrue==true){
	        $.blockUI({ message: '<div><img src="${ctx}/static/images/busy.gif" /><font size="4px"> Just a moment...</font></div>' }); 
	        select_all_loan(); 
	    }
    }); 
    
    $('#SellConfirm').click(function() { 
        if(mainform1_init() ){
	        $.blockUI({ message: '<div><img src="${ctx}/static/images/busy.gif" /><font size="4px"> Just a moment...</font></div>' }); 
	 		ajaxQueryLoanInfos();
		 	bb(3);
	 	}else{
	 		return;
	 	}
    }); 
    
    $('#tzbutton').click(function() { 
        ajax_get_page_investInfos();
    });
});
function select_all_loan(){
	$.get("${ctx}/loansc/ajax_query_all_loanInfos?accountNo="+GetInputValue('accountNo')+"&appdate="+GetInputValue('appointPaymentDate'), function(data) {
		sellAllLoan(data);
	});
}

function sellAllLoan(data){
	var allloan = data;//ajax get all
	var LedgerLoan = null;
	var LedgerFinance = null;
	var lineValue =null;
	var key = null;
	for(var i=0;i<allloan.result.length;i++){
		LedgerFinance = allloan.result[i];
		LedgerLoan  =  LedgerFinance.loanAcct;
		key = LedgerFinance.id.toString();
		var sellamt = (LedgerFinance.loanAmount_1 * (LedgerFinance.debtProportion-LedgerFinance.appScal) );
		var sellmat2 = 0;
		sellmat2 = interceptionDouble(sellamt);
		if(sellamt==0){
			alert('卖出债权中含有零值金额!');
			return ;
		}
	
		lineValue = new Array(); 
		lineValue[0] = LedgerLoan.id;
		lineValue[1] = LedgerLoan.customerName;
		lineValue[2] = LedgerFinance.debtProportion
		lineValue[3] = LedgerFinance.debtAmount;
		lineValue[4] = (LedgerFinance.debtProportion-LedgerFinance.appScal);//可卖比例
		lineValue[5] = (LedgerFinance.appScal);//已卖比例
		lineValue[6] = (LedgerFinance.loanAmount_1);
		lineValue[7] = (sellamt);
		lineValue[8] = (LedgerFinance.debtProportion-LedgerFinance.appScal);//TODO
		lineValue[9] = LedgerFinance.id;
		lineValue[10] = LedgerLoan.rateSpare;
		lineValue[11] = LedgerLoan.productCode;
		lineValue[12] = (LedgerFinance.debtProportion-LedgerFinance.appScal);//可卖比例
		lineValue[13] = dictionary.get(GetInputValue('loanReturnDate'));
		lineValue[14] = (GetInputValue('investId-h'));
		lineValue[15] = LedgerLoan.id;
		lineValue[16]=	(new Date(LedgerLoan.dateSpare)).pattern("yyyy-MM-dd");
		lineValue[17]=	LedgerLoan.rate;
		lineValue[18]=	sellmat2;//容错界面看到保留两位
		lineValue[19]=	(LedgerFinance.loanAmount_1);//保留全部小数 约定交割日价值(与[6]相同 )
		AllLoanArray.put(key,lineValue);
	}
	sellorderArray = AllLoanArray;
	mainform2Response();
	bb(2);
}
//全部卖出功能-----------------------------------end------------------------------------------

//分页功能-----------------------------------start------------------------------------------

//分页功能-----------------------------------end------------------------------------------

</script>
</body>
</html>


